package com.wn.work;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2023 -02-28
 * @desc  测试消息拒绝 发送到死信交互机中 通过 死信路由到 死信队列中
 *        死信消费者进行消费
 */
@Component
public class Work06Provider {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(String exchangeName,String key,String msg){

        rabbitTemplate.convertAndSend(exchangeName,key,msg);

    }

    /**
     * 发送对象
     * @param exchangeName
     * @param key
     * @param obj
     */
    public void sendObj(String exchangeName,String key,Object obj){
        rabbitTemplate.convertAndSend(exchangeName,key,obj);
    }
}
